import request from '@/utils/request'
/**
 *获取所有角色列表
 */
export const reqGetSole = (page, pagesize) => {
  return request({
    method: 'get',
    url: '/sys/role',
    params: {
      page,
      pagesize
    }
  })
}

/**
 * 根据id删除角色
 */
export const reqGetDelRole = (id) => {
  return request({
    method: 'delete',
    url: `/sys/role/${id}`
  })
}

/**
 * 添加角色
 * @param {*} data
 * @returns
 */
export const reqGetAddRoles = (data) => {
  return request({
    method: 'post',
    url: '/sys/role',
    data
  })
}

/**
 * 根据id获取角色详细(用于数据回显)
 */
export const reqGetRoleId = (id) => {
  return request({
    method: 'get',
    url: `/sys/role/${id}`
  })
}

/**
 *根据id进行角色更新
 * @param {*} form
 * @returns
 */
export const reqGetUpdataRole = (form) => {
  return request({
    method: 'put',
    url: `/sys/role/${form.id}`,
    data: form
  })
}
/** *
 * 给员工分配角色
 * ***/
export function reqAssignRoles (data) {
  return request({
    url: '/sys/user/assignRoles',
    data,
    method: 'put'
  })
}
// 给角色分配权限
export function reqAssignPerm (data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
